package sicnu.cs.ich.api.common.enums;


import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.apache.logging.log4j.util.Strings;

import java.util.NoSuchElementException;

/**
 * @author CaiKe
 */

@Getter
@ToString
@AllArgsConstructor
@NoArgsConstructor
public enum ConfigEnum {
    // 配置表字段
    // id一定要和数据库对应！
    ICH_HIT_ALL(1,"ich_hit_all", "非遗总访问量（总热度）"),
    ICH_HIT_MAP(2,"ich_hit_map", "非遗热度Map"),
    ICH_HIT_TYPE(3,"ich_hit_type", "非遗类别热度"),
    CERT_SEQ(4,"cert_seq","认证编号"),
    ICH_HIT_UPDATED(5,"ich_hit_updated", "非遗热力绑上次更新的时间戳"),

    ACTIVITY_HIT_Gravity()
    ;

    Integer id;
    String key;
    String description;

    public static ConfigEnum valueOf(int id) {
        for (ConfigEnum configEnum : ConfigEnum.values()) {
            if (configEnum.getId().equals(id)) {
                return configEnum;
            }
        }
        throw new NoSuchElementException("无 " + id + " 对应的ConfigEnum");
    }
}
